package 网易机试;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class 第一题2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String s = sc.nextLine();
            System.out.println(func(s));
        }
        sc.close();
    }

    private static int func(String s) {
        if (s.length() == 1)
            return 1;

        int[] a = new int[s.length()];
        for (int i = 0; i < s.length(); i++) {
            a[i] = Integer.parseInt(String.valueOf(s.charAt(i)));
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < a.length - 1; i++) {
            if (a[i + 1] == a[i])
                sb.append(0);
            else
                sb.append(1);
        }

        System.out.println(sb.toString());

        int len = 0;
        Matcher m = Pattern.compile("[1]+").matcher(sb.toString());
        while (m.find()) {
            String str = m.group();
            len = Math.max(len, str.length());
        }
        return len + 1;
    }
}
